package com.zzyl.mapper;

import com.zzyl.entity.Role;
import com.zzyl.entity.RoleResource;
import com.zzyl.vo.RoleVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RoleResourceMapper {
    /**
     * 根据角色id查询资源列表
     * @param roleId
     * @return
     */
    @Select("select resource_no from sys_role_resource where role_id = #{roleId} ")
    List<RoleVo> selectResourceNoByRoleId(Long roleId);

    /**
     * 删除角色相关资源信息
     * @param roleIds
     */
    @Delete("delete from sys_role_resource where role_id = #{roleIds}")
    void deleteByRoleId(String roleIds);

    /**
     * 插入子目录
     * @param roleResourceList
     */
    void batchInsert(@Param("list") List<RoleResource> roleResourceList);
}
